<template>
    <h1>理财赎回</h1>

    <table>
        <thead>
            <tr>
                <th>理财编号</th>
                <th>理财名称</th>
                <th>年收益</th>
                <th>月收益</th>
                <th>最低金额</th>
                <th>风险等级</th>
                <th>操作</th>
            </tr>
        </thead>

        <tbody>
            <tr v-for="item in Show" >
                <td>{{ item.F_FId }}</td>
                <td>{{ item.F_FName }}</td>
                <td>{{ item.F_YearMoney }}</td>
                <td>{{Number( Number(item.F_YearMoney)/12 ).toFixed(2)  }}</td>
                <td>{{ item.F_MinMoney }}</td>
                <td>{{ Number(item.F_FinanLevel) ==0?"低风险": item.F_FinanLevel?"中风险":"高风险" }}</td>
                <td>
                    <a href="#" @click="jump(item.UF_Id)" >赎回</a>
                </td>
            </tr>
        </tbody>

    </table>


</template>

<script setup lang="ts">
import {ref,onMounted} from 'vue';
import axios from 'axios'
import { useUserStore} from '../../store/index.ts'
import { useRouter } from 'vue-router';

const router = useRouter();

const userStore = useUserStore();

const Show = ref([{
    F_FId:'',
    F_FName:'',
    F_YearMoney:'',
    F_MinMoney:'',
    F_FinanLevel:'',
    UF_Id:''
}])

onMounted (()=>{
    UserFinancingRedeemShow();
})

const UserFinancingRedeemShow = () =>{
    axios({
        method:'get',
        url:'http://localhost:56707/api/Finan/UserFinancingRedeemShow',
        params:{
            Id:userStore.Uid
        }
    })
    .then(function(res){
        console.log(res.data);
        Show.value = res.data;
    })
    .catch(function(error){
        console.log(error);
    })
}

const jump = (Id:string)=>{
    router.push({
        name:'AddUserFinanRedeem',
        params:{
            Id:Id
        }
    })
}


</script>
